﻿<!--
 * Almathy Center - ConnectionWindow.xaml
 * Copyright (C) 2011 Christophe LEMOINE
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<Window x:Class="AlmathyCenter.ConnectionWindow" x:Name="window"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:prop="clr-namespace:AlmathyCenter.Properties"
        xmlns:lib="clr-namespace:AlmathyCenter"
        Title="Almathy Center - Connexion" Height="336" Width="398" Icon="/AlmathyCenter;component/Images/connect.png" ResizeMode="NoResize" ShowInTaskbar="True" Topmost="False" WindowStartupLocation="CenterScreen" Closing="window_Closing" SizeToContent="Height">
    <DockPanel RenderOptions.BitmapScalingMode="HighQuality">
        <Grid IsEnabled="True" Name="statusBar1" VerticalAlignment="Bottom" Background="#FF293955" DockPanel.Dock="Bottom">
            <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="10">
                <Expander Header="Paramêtres" Name="expander1" Foreground="White" Width="357">
                    <Grid Margin="8,8,8,8" Height="200" HorizontalAlignment="Stretch">
                        <Label Content="Hôte:" Height="28" HorizontalAlignment="Left" Margin="6,6,0,0" Name="label3" VerticalAlignment="Top" Foreground="White" />
                        <TextBox Height="23" Margin="6,35,6,0" Name="hostBox" VerticalAlignment="Top" KeyUp="serverBox_KeyUp" TabIndex="4" />
                        <Label Content="Port:" Height="28" HorizontalAlignment="Left" Margin="269,64,0,0" Name="label4" VerticalAlignment="Top" Foreground="White" />
                        <TextBox Height="23" Margin="0,90,6,0" Name="portBox" VerticalAlignment="Top" Text="5222" MaxLength="5" HorizontalAlignment="Right" HorizontalContentAlignment="Right" TabIndex="5" Width="64" IsEnabled="{Binding ElementName=checkBox1, Path=IsChecked}">
                            <TextBox.Style>
                                <Style TargetType="{x:Type TextBox}">
                                    <Style.Triggers>
                                        <Trigger Property="IsEnabled" Value="False" >
                                            <Setter Property="Opacity" Value="0.5" />
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBox.Style>
                        </TextBox>
                        <CheckBox Content="Si l'options est disponible, compresser les échanges." Height="16" HorizontalAlignment="Left" Margin="6,137,0,0" Name="checkCompression" VerticalAlignment="Top" Foreground="White" TabIndex="6" />
                        <CheckBox Content="Si l'option est disponible, crypter les échanges." Height="16" HorizontalAlignment="Left" Margin="6,159,0,0" Name="checkSSL" VerticalAlignment="Top" Foreground="White" TabIndex="7" Checked="checkSSL_Checked" Unchecked="checkSSL_Unchecked" />
                        <TextBox Height="23" Margin="6,90,76,0" Name="serverBox" TabIndex="4" VerticalAlignment="Top" IsEnabled="{Binding ElementName=checkBox1, Path=IsChecked}">
                            <TextBox.Style>
                                <Style TargetType="{x:Type TextBox}">
                                    <Style.Triggers>
                                        <Trigger Property="IsEnabled" Value="False" >
                                            <Setter Property="Opacity" Value="0.5" />
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBox.Style>
                        </TextBox>
                        <CheckBox Content="Serveur:" Foreground="White" Height="16" HorizontalAlignment="Left" Margin="6,69,0,0" Name="checkBox1" TabIndex="6" VerticalAlignment="Top" />
                    </Grid>
                </Expander>
            </StackPanel>
        </Grid>
        <Grid HorizontalAlignment="Stretch" Name="grid1" VerticalAlignment="Stretch" Background="#FFCED4DF">
            <Grid.Effect>
                <DropShadowEffect Direction="270" Opacity="0.3" />
            </Grid.Effect>
            <Button Content="Connexion..." Margin="0,211,15,15" Name="connectionButton" HorizontalAlignment="Right" Width="104" IsDefault="True" IsEnabled="False" VerticalAlignment="Top" Height="27" Click="connectionButton_Click" TabIndex="3" />
            <Label Content="Nom d'utilisateur:" Height="28" HorizontalAlignment="Left" Margin="43,100,0,0" Name="label1" VerticalAlignment="Top" />
            <PasswordBox Margin="153,134,15,0" Name="passwordBox" KeyUp="passwordBox_KeyUp" TabIndex="1" Height="23" VerticalAlignment="Top" />
            <Label Content="Mot de passe:" Height="28" HorizontalAlignment="Left" Margin="63,134,0,0" Name="label2" VerticalAlignment="Top" />
            <TextBlock Margin="6,174,6,0" Name="statusMessage" Text="" TextAlignment="Center" TextTrimming="WordEllipsis" VerticalAlignment="Top" Height="24" />
            <Grid Name="grid2" VerticalAlignment="Top">
                <TextBlock Height="69" Margin="10,10,10,10" Name="textBlock1" Text="Bienvenue sur Almathy Center. Cette fenêtre permet de vous connecter au serveur de votre choix. La première fois, toutes les informations sont nécessaires, après seulement votre nom d'utilisateur et mot de passe seront requis." VerticalAlignment="Top" TextWrapping="WrapWithOverflow" TextTrimming="WordEllipsis" TextAlignment="Left" />
                <Grid.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="White" Offset="0" />
                        <GradientStop Color="#FFCED4DF" Offset="1" />
                    </LinearGradientBrush>
                </Grid.Background>
            </Grid>
            <ComboBox IsSynchronizedWithCurrentItem="False" Height="23" Margin="153,100,15,0" Name="usernameBox" VerticalAlignment="Top" IsEditable="True" DataContext="{Binding}" LostFocus="usernameBox_LostFocus" KeyUp="usernameBox_KeyUp" TabIndex="0" SelectionChanged="usernameBox_SelectionChanged" TargetUpdated="usernameBox_TargetUpdated">
                <ComboBox.ToolTip>
                    <TextBlock>
                        Si ce compte est en favoris, vous pouvez le retirer de la liste en appuyant sur <Bold>[SHIFT]+[SUPPR]</Bold>.
                    </TextBlock>
                </ComboBox.ToolTip>
                <ComboBox.ItemTemplate>
                    <HierarchicalDataTemplate>
                        <StackPanel Orientation="Horizontal" Margin="0" Height="24">
                            <Image VerticalAlignment="Center" HorizontalAlignment="Left" Source="/AlmathyCenter;component/Images/star.png" Margin="2,2,2,2" Width="16" Height="16" />
                            <Label Margin="0" FontSize="11" VerticalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Left" HorizontalContentAlignment="Left" Content="{Binding Username}" Tag="{RelativeSource FindAncestor, AncestorType={x:Type ComboBox}}" FontWeight="Bold" />
                            <Label Margin="0" FontSize="10" VerticalContentAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Left" HorizontalContentAlignment="Left" Content="{Binding Jid.Bare}" Tag="{RelativeSource FindAncestor, AncestorType={x:Type ComboBox}}" />
                        </StackPanel>
                    </HierarchicalDataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
        </Grid>
    </DockPanel>
</Window>